var listview_render = jQuery.extend(true, {}, base_render, {
    components:{
        ul:   jQuery("div[data-role='content']").find("ul[data-role='listview']")
    },

    handler: function(items) {
        var _render = this;
        var ul = _render.components.ul;
        ul.html(_render.gen_listview(items));

        if(ul.jqmData("role") == "listview"){
            ul.listview("refresh");
        }
    },

    gen_listview: function(items) {
        var _render = this;
        var list = [];
        for(var i=0, len=items.length; i<len; i++) {
            list.push(_render.gen_listview_item(items[i]));
        }

        return list.join("");
    },

    gen_listview_item: function(item) {
        return "";
    },

    pull_down: function(url, params) {
        var _render = this;
        return jQuery.getJSON(url, params, function(items) {
            _render.pull_down_handler(items);
        });
    },

    pull_up: function(url, params) {
        var _render = this;
        return jQuery.getJSON(url, params, function(items) {
            _render.pull_up_handler(items);
        });
    },

    pull_down_handler: function(items) {
        var _render = this;
        var ul = _render.components.ul;
        ul.prepend(_render.gen_listview(items));

        if(ul.jqmData("role") == "listview") {
            ul.listview("refresh");
        }
    },

    pull_up_handler: function(items) {
        var _render = this;
        var ul = _render.components.ul;
        ul.append(_render.gen_listview(items));

        if(ul.jqmData("role") == "listview") {
            ul.listview("refresh");
        }
    },
});

